<div class="isi">

    <div id="tabs" style="margin-bottom: 10px;">
        <ul>
            <li><a href="#tabs-1">Data Produk</a></li>
            <li><a href="#tabs-2">Data Detail Produk</a></li>
        </ul>
        <div id="tabs-1" style="padding: 10px 12px 12px 12px;">
            <?php
            $atr = array('id' => 'formID',
                'class' => 'formular');
            echo form_open_multipart('admin_produk/update', $atr);
            ?> 
            <input type="hidden"  name="tmp_id" id="tmp_id"  value="<?php echo $produk->id ?>"/>
            <table width="100%"  >
                <tr>
                    <td width="15%" ><p> Katagori Produk  </p> </td>
                    <td><p> : </p> </td>
                    <td> 
                        <select name="id_katagori" id="id_katagori" class="validate[required] text-input" > 
                            <option value="">Pilih Katagori : </option>
                            <?php
                            foreach ($list_katagori as $dta) {
                                if ($dta->id == $produk->id_katagori)
                                    $sel = "selected";
                                else
                                    $sel = "";
								if($dta->parentid == 0){
									echo "<option value='$dta->id' $sel> $dta->nama_katagori **(Parent)</option>";
								} else {
									echo "<option value='$dta->id' $sel> $dta->nama_katagori</option>";
								}
                            }
                            ?>
                        </select>
                </tr>
                <tr>
                    <td width="15%" ><p> ID Produk </p> </td>
                    <td><p> : </p> </td>
                    <td> <input type="text" size="7" readonly name="id" id="id" class="validate[required,maxSize[5],minSize[5],custom[integer]] text-input" value="<?php echo $produk->id ?>"/> </td>
                </tr>
                <tr>
                    <td width="15%"><p> Nama Produk  </p> </td>
                    <td><p> : </p> </td>
                    <td> <input type="text" name="nama_produk" id="nama_produk" size="50" class="validate[required] text-input" value="<?php echo $produk->nama_produk ?>"/> </td>
                </tr>            
                <tr>
                    <td width="15%"><p> Warna  </p> </td>
                    <td><p> : </p> </td>
                    <td> <input type="text" name="warna" id="warna" size="30" class="validate[required] text-input" value="<?php echo $produk->warna ?>"/> </td>
                </tr>   
                <tr>
                    <td width="15%"><p> Harga </p> </td>
                    <td><p> : </p> </td>
                    <td> <input type="text" name="harga" id="harga" size="20" style="text-align: right;"  class="validate[required,custom[integer]]" value="<?php echo $produk->harga ?>"/> </td>
                </tr>      
                <tr>
                    <td width="15%"><p> Disk (%) </p> </td>
                    <td><p> : </p> </td>
                    <td> <input type="text" name="disk" id="disk" size="5" class="validate[required,custom[integer]]" value="<?php echo $produk->disk ?>"/> </td>
                </tr>               

                <tr>
                    <td width="15%" style="vertical-align: top;"><p> Keterangan  </p> </td>
                    <td  style="vertical-align: top;"><p> : </p> </td>
                    <td> <textarea rows="4" cols="45" name="keterangan" id="my_editor"  id="keterangan" class="validate[required] text-input"><?php echo $produk->keterangan ?></textarea></td>
                </tr>    
                <tr>
                    <td width="15%"><p> Image 1  </p> </td>
                    <td><p> : </p> </td>
                    <td> <input type="file" name="image1" id="image1" /> 
                        <?php
                        if ($produk->image1 != "")
                            echo "<a id='example7' href='" . base_url() . "/uploads/" . $produk->id . "/" . $produk->image1 . "'> (lihat Gambar) </a>";
                        ?>
                    </td>
                </tr> 
                <tr>
                    <td width="15%"><p> Image 2  </p> </td>
                    <td><p> : </p> </td>
                    <td> <input type="file" name="image2" id="image2" /> 
                        <?php
                        if ($produk->image2 != "")
                            echo "<a id='example7' href='" . base_url() . "/uploads/" . $produk->id . "/" . $produk->image2 . "'> (lihat Gambar) </a>";
                        ?>
                    </td>
                </tr>   
                <tr>
                    <td width="15%"><p> Image 3  </p> </td>
                    <td><p> : </p> </td>
                    <td> <input type="file" name="image3" id="image3" /> 
                        <?php
                        if ($produk->image3 != "")
                            echo "<a id='example7' href='" . base_url() . "/uploads/" . $produk->id . "/" . $produk->image3 . "'> (lihat Gambar) </a>";
                        ?>
                    </td>
                </tr>    
                <tr>
                    <td width="15%"><p> Status </p> </td>
                    <td><p> : </p> </td>
                    <td>
                        <select style="width: 105px" name="status" id="status">
                            <?php
                            if ($produk->status) {
                                echo "<option value='1' selected>Aktif</option>";
                                echo "<option value='0'>Pasif</option>";
                            } else {
                                echo "<option value='1'>Aktif</option>";
                                echo "<option value='0' selected>Pasif</option>";
                            }
                            ?>

                        </select>
                    </td>
                </tr> 
            </table>                
            <br/>
            <?php echo anchor("admin_produk", "Kembali", "class='button' style='color:white;'"); ?>
            <input type="submit" value="         Simpan       " class="button"/>
            </form>

        </div>


        <div id="tabs-2" style="padding: 10px 12px 12px 12px;">
            <?php echo anchor("admin_produk/tambah_det/" . $produk->id, "Tambah Data Produk Detail", "class='button' style='color:white;'") ?>

            <table id="laporan2" class="display"  >
                <thead>
                    <tr>
                        <th width="5%">No</th>
                        <th>Size Produk</th>
                        <th>Stok Produk</th>
                        <th>Berat</th>
                        <th>Status</th>
                        <th width="5%">Tindakan</th>
                    </tr>            
                </thead>
                <tbody>
                    <?php
                    $n = 1;
                    $img_delete = $this->lib_button->delete_icon();
                    $img_update = $this->lib_button->edit_icon();
                    foreach ($produk_det as $dt) {
                        $link_hapus = anchor('admin_produk/delete_det/' . $dt->id, $img_delete, array('onClick' => 'return confirm(\'Apa anda yakin akan menghapus data ini ?\');'));
                        $link_edit = anchor('admin_produk/edit_det/' . $dt->id, $img_update);
                        echo "<tr>";
                        echo "<td>$n</td>";
                        echo "<td>$dt->size_produk</td>";
                        echo "<td>$dt->stok</td>";
                        echo "<td>$dt->berat</td>";
                        if ($dt->status)
                            echo "<td>Aktif</td>";
                        else
                            echo "<td>Pasif</td>";
                        echo "<td>$link_edit $link_hapus</td>";
                        echo "</tr>";
                        $n++;
                    }
                    ?>
                </tbody>
            </table>                  
        </div>
    </div>        

    <div class="clear"></div>
</div>